#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;


class Solution {
public:
    int findContentChildren(vector<int>& g, vector<int>& s) {
        sort(g.begin(), g.end());
        sort(s.begin(), s.end());
        int cnt = 0;
        int sum = 0;
        for (int i = 0; i < (int)s.size(); i++)
        {
            if (s[i] >= g[cnt])
            {
                sum++;
                cnt++;
            }
            if (cnt == g.size())
            {
                break;
            }
        }
        return sum;
    }

    
};